{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "307804a3-c02b-4a57-ac0d-172c30ddc851",
   "metadata": {},
   "source": [
    "# Elasticsearch Vector Store"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "67837810",
   "metadata": {},
   "source": [
    "Elasticsearch is a distributed, RESTful search and analytics engine, capable of performing both vector and keyword search. It is built on top of the Apache Lucene library.\n",
    "\n",
    "[Signup](https://cloud.elastic.co/registration?utm_source=llama-index&utm_content=documentation) for a free trial.\n",
    "\n",
    "Requires Elasticsearch 8.9.0 or higher and AIOHTTP."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "d48af8e1",
   "metadata": {},
   "outputs": [],
   "source": [
    "import logging\n",
    "import sys\n",
    "import os\n",
    "\n",
    "logging.basicConfig(stream=sys.stdout, level=logging.INFO)\n",
    "logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))\n",
    "\n",
    "import getpass\n",
    "\n",
    "os.environ[\"OPENAI_API_KEY\"] = getpass.getpass(\"OpenAI API Key:\")\n",
    "import openai\n",
    "\n",
    "openai.api_key = os.environ[\"OPENAI_API_KEY\"]"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "5b28b0ba",
   "metadata": {},
   "source": [
    "## Running and connecting to Elasticsearch\n",
    "Two ways to setup an Elasticsearch instance for use with:\n",
    "\n",
    "### Elastic Cloud\n",
    "Elastic Cloud is a managed Elasticsearch service. [Signup](https://cloud.elastic.co/registration?utm_source=llama-index&utm_content=documentation) for a free trial.\n",
    "\n",
    "### Locally\n",
    "Get started with Elasticsearch by running it locally. The easiest way is to use the official Elasticsearch Docker image. See the Elasticsearch Docker documentation for more information.\n",
    "\n",
    "```bash\n",
    "docker run -p 9200:9200 \\\n",
    "  -e \"discovery.type=single-node\" \\\n",
    "  -e \"xpack.security.enabled=false\" \\\n",
    "  -e \"xpack.security.http.ssl.enabled=false\" \\\n",
    "  -e \"xpack.license.self_generated.type=trial\" \\\n",
    "  docker.elastic.co/elasticsearch/elasticsearch:8.9.0\n",
    "```\n",
    "\n",
    "## Configuring ElasticsearchStore\n",
    "The ElasticsearchStore class is used to connect to an Elasticsearch instance. It requires the following parameters:\n",
    "\n",
    "        - index_name: Name of the Elasticsearch index. Required.\n",
    "        - es_client: Optional. Pre-existing Elasticsearch client.\n",
    "        - es_url: Optional. Elasticsearch URL.\n",
    "        - es_cloud_id: Optional. Elasticsearch cloud ID.\n",
    "        - es_api_key: Optional. Elasticsearch API key.\n",
    "        - es_user: Optional. Elasticsearch username.\n",
    "        - es_password: Optional. Elasticsearch password.\n",
    "        - text_field: Optional. Name of the Elasticsearch field that stores the text.\n",
    "        - vector_field: Optional. Name of the Elasticsearch field that stores the\n",
    "                    embedding.\n",
    "        - batch_size: Optional. Batch size for bulk indexing. Defaults to 200.\n",
    "        - distance_strategy: Optional. Distance strategy to use for similarity search.\n",
    "                        Defaults to \"COSINE\".\n",
    "\n",
    "### Example: Connecting locally\n",
    "```python\n",
    "from llama_index.vector_stores import ElasticsearchStore\n",
    "\n",
    "es = ElasticsearchStore(\n",
    "    index_name=\"my_index\",\n",
    "    es_url=\"http://localhost:9200\",\n",
    ")\n",
    "```\n",
    "\n",
    "### Example: Connecting to Elastic Cloud with username and password\n",
    "\n",
    "```python\n",
    "from llama_index.vector_stores import ElasticsearchStore\n",
    "\n",
    "es = ElasticsearchStore(\n",
    "    index_name=\"my_index\",\n",
    "    es_cloud_id=\"<cloud-id>\", # found within the deployment page\n",
    "    es_user=\"elastic\"\n",
    "    es_password=\"<password>\" # provided when creating deployment. Alternatively can reset password.\n",
    ")\n",
    "```\n",
    "\n",
    "### Example: Connecting to Elastic Cloud with API Key\n",
    "\n",
    "```python\n",
    "from llama_index.vector_stores import ElasticsearchStore\n",
    "\n",
    "es = ElasticsearchStore(\n",
    "    index_name=\"my_index\",\n",
    "    es_cloud_id=\"<cloud-id>\", # found within the deployment page\n",
    "    es_api_key=\"<api-key>\" # Create an API key within Kibana (Security -> API Keys)\n",
    ")\n",
    "```\n"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "8ee4473a-094f-4d0a-a825-e1213db07240",
   "metadata": {},
   "source": [
    "#### Load documents, build VectorStoreIndex with Elasticsearch"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "0a2bcc07",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "INFO:numexpr.utils:Note: NumExpr detected 10 cores but \"NUMEXPR_MAX_THREADS\" not set, so enforcing safe limit of 8.\n",
      "Note: NumExpr detected 10 cores but \"NUMEXPR_MAX_THREADS\" not set, so enforcing safe limit of 8.\n",
      "INFO:numexpr.utils:NumExpr defaulting to 8 threads.\n",
      "NumExpr defaulting to 8 threads.\n"
     ]
    }
   ],
   "source": [
    "from llama_index import VectorStoreIndex, SimpleDirectoryReader\n",
    "from llama_index.vector_stores import ElasticsearchStore"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "68cbd239-880e-41a3-98d8-dbb3fab55431",
   "metadata": {},
   "outputs": [],
   "source": [
    "# load documents\n",
    "documents = SimpleDirectoryReader(\"../data/paul_graham\").load_data()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "ba1558b3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "INFO:elastic_transport.transport:GET http://localhost:9200/ [status:200 duration:0.024s]\n",
      "GET http://localhost:9200/ [status:200 duration:0.024s]\n",
      "INFO:elastic_transport.transport:HEAD http://localhost:9200/paul_graham [status:200 duration:0.011s]\n",
      "HEAD http://localhost:9200/paul_graham [status:200 duration:0.011s]\n",
      "INFO:elastic_transport.transport:PUT http://localhost:9200/_bulk?refresh=true [status:200 duration:0.115s]\n",
      "PUT http://localhost:9200/_bulk?refresh=true [status:200 duration:0.115s]\n",
      "INFO:elastic_transport.transport:PUT http://localhost:9200/_bulk?refresh=true [status:200 duration:0.083s]\n",
      "PUT http://localhost:9200/_bulk?refresh=true [status:200 duration:0.083s]\n"
     ]
    }
   ],
   "source": [
    "# initialize without metadata filter\n",
    "from llama_index.storage.storage_context import StorageContext\n",
    "\n",
    "vector_store = ElasticsearchStore(\n",
    "    es_url=\"http://localhost:9200\",\n",
    "    # Or with Elastic Cloud\n",
    "    # es_cloud_id=\"my_cloud_id\",\n",
    "    # es_user=\"elastic\",\n",
    "    # es_password=\"my_password\",\n",
    "    index_name=\"paul_graham\",\n",
    ")\n",
    "storage_context = StorageContext.from_defaults(vector_store=vector_store)\n",
    "index = VectorStoreIndex.from_documents(documents, storage_context=storage_context)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "04304299-fc3e-40a0-8600-f50c3292767e",
   "metadata": {},
   "source": [
    "## Basic Example\n",
    "We are going to ask the query engine a question about the data we just indexed."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "35369eda",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "INFO:elastic_transport.transport:POST http://localhost:9200/paul_graham/_search [status:200 duration:0.030s]\n",
      "POST http://localhost:9200/paul_graham/_search [status:200 duration:0.030s]\n",
      "He invested $6k per founder, which in the typical two-founder case was $12k, in return for 6%.\n"
     ]
    }
   ],
   "source": [
    "# set Logging to DEBUG for more detailed outputs\n",
    "query_engine = index.as_query_engine()\n",
    "response = query_engine.query(\"what were his investments in Y Combinator?\")\n",
    "print(response)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "056d6a4a",
   "metadata": {},
   "source": [
    "## Metadata Filters\n",
    "Here we are going to index a few documents with metadata so that we can apply filters to the query engine."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "b298cc87",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "INFO:elastic_transport.transport:GET http://localhost:9200/ [status:200 duration:0.012s]\n",
      "GET http://localhost:9200/ [status:200 duration:0.012s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "INFO:elastic_transport.transport:HEAD http://localhost:9200/movies_metadata_example [status:404 duration:0.022s]\n",
      "HEAD http://localhost:9200/movies_metadata_example [status:404 duration:0.022s]\n",
      "INFO:elastic_transport.transport:PUT http://localhost:9200/movies_metadata_example [status:200 duration:0.099s]\n",
      "PUT http://localhost:9200/movies_metadata_example [status:200 duration:0.099s]\n",
      "INFO:elastic_transport.transport:PUT http://localhost:9200/_bulk?refresh=true [status:200 duration:0.053s]\n",
      "PUT http://localhost:9200/_bulk?refresh=true [status:200 duration:0.053s]\n",
      "INFO:elastic_transport.transport:PUT http://localhost:9200/_bulk?refresh=true [status:200 duration:0.023s]\n",
      "PUT http://localhost:9200/_bulk?refresh=true [status:200 duration:0.023s]\n",
      "INFO:elastic_transport.transport:POST http://localhost:9200/movies_metadata_example/_search [status:200 duration:0.034s]\n",
      "POST http://localhost:9200/movies_metadata_example/_search [status:200 duration:0.034s]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[NodeWithScore(node=TextNode(id_='3b47c6b6-f01b-44fe-8f88-2249aad2a615', embedding=None, metadata={'director': 'Francis Ford Coppola', 'theme': 'Mafia'}, excluded_embed_metadata_keys=[], excluded_llm_metadata_keys=[], relationships={}, hash='81cf4b9e847ba42e83fc401e31af8e17d629f0d5cf9c0c320ec7ac69dd0257e1', text='The Godfather', start_char_idx=None, end_char_idx=None, text_template='{metadata_str}\\n\\n{content}', metadata_template='{key}: {value}', metadata_seperator='\\n'), score=0.88513875)]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from llama_index.schema import TextNode\n",
    "\n",
    "nodes = [\n",
    "    TextNode(\n",
    "        text=\"The Shawshank Redemption\",\n",
    "        metadata={\n",
    "            \"author\": \"Stephen King\",\n",
    "            \"theme\": \"Friendship\",\n",
    "        },\n",
    "    ),\n",
    "    TextNode(\n",
    "        text=\"The Godfather\",\n",
    "        metadata={\n",
    "            \"director\": \"Francis Ford Coppola\",\n",
    "            \"theme\": \"Mafia\",\n",
    "        },\n",
    "    ),\n",
    "    TextNode(\n",
    "        text=\"Inception\",\n",
    "        metadata={\n",
    "            \"director\": \"Christopher Nolan\",\n",
    "        },\n",
    "    ),\n",
    "]\n",
    "\n",
    "# initialize the vector store\n",
    "vector_store_metadata_example = ElasticsearchStore(\n",
    "    index_name=\"movies_metadata_example\",\n",
    "    es_url=\"http://localhost:9200\",\n",
    ")\n",
    "storage_context = StorageContext.from_defaults(\n",
    "    vector_store=vector_store_metadata_example\n",
    ")\n",
    "index = VectorStoreIndex(nodes, storage_context=storage_context)\n",
    "\n",
    "\n",
    "# Metadata filter\n",
    "from llama_index.vector_stores.types import ExactMatchFilter, MetadataFilters\n",
    "\n",
    "filters = MetadataFilters(filters=[ExactMatchFilter(key=\"theme\", value=\"Mafia\")])\n",
    "\n",
    "retriever = index.as_retriever(filters=filters)\n",
    "\n",
    "retriever.retrieve(\"What is inception about?\")"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "5b7436ea",
   "metadata": {},
   "source": [
    "## Custom Filters and overriding Query \n",
    "llama-index supports ExactMatchFilters only at the moment. Elasticsearch supports a wide range of filters, including range filters, geo filters, and more. To use these filters, you can pass them in as a list of dictionaries to the `es_filter` parameter."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "5a58114d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "custom query {'knn': {'filter': [{'match': {'content': 'growing up'}}], 'field': 'embedding', 'query_vector': [0.002520269714295864, -0.03282919153571129, 0.016138022765517235, -0.029537975788116455, -0.006744919344782829, 0.01626248098909855, -0.03703309968113899, 0.002381983445957303, -0.003031929489225149, -0.003616189584136009, 0.032746221870183945, 0.030201751738786697, 0.011726687662303448, 0.005043996497988701, 0.0030665011145174503, 0.016207166016101837, 0.018115518614649773, -0.008539185859262943, 0.020825933665037155, -0.011595315299928188, -0.027754081413149834, -0.004622223321348429, -0.004750138148665428, -0.015363619662821293, -0.006496003828942776, 0.012860636226832867, 0.02331508882343769, -0.009368903934955597, -0.002686213469132781, 0.0029818005859851837, 0.032441992312669754, 0.0015107790241017938, -0.0023059258237481117, 0.02384057641029358, -0.029233746230602264, 0.003574703587219119, 0.0048296526074409485, 0.019401581957936287, 0.01830912008881569, -0.009375818073749542, 0.037724532186985016, 0.026274416595697403, -0.016746483743190765, -0.005078568123281002, -0.02065998874604702, -0.012846807017922401, -0.002015524310991168, -0.01924946717917919, -0.0026568276807665825, 0.01626248098909855, -0.0002582066517788917, 0.027449851855635643, -0.011975603178143501, 0.013517496176064014, -0.005973972845822573, 0.002910928800702095, -0.00517536886036396, -0.004521965514868498, -0.012466519139707088, 0.0037890474777668715, 0.03454394266009331, 0.020729131996631622, 1.9514049199642614e-05, 0.010191707871854305, -0.0201068427413702, -0.0031131727155297995, 0.003581617958843708, -0.027270078659057617, 0.016151852905750275, 0.01658054068684578, 0.04679612070322037, -0.00013904266234021634, 0.01688477024435997, -0.00204491033218801, 0.014326471835374832, 0.0006266103009693325, -0.01454772986471653, -0.01425732858479023, -0.026039330288767815, 0.021296106278896332, 0.0022454254794865847, -0.03457160294055939, -0.028016826137900352, -0.009548676200211048, 0.0005151168443262577, -0.0019308238988742232, -0.00028759249835275114, 0.020203644409775734, -0.021890738978981972, 0.0035505034029483795, 0.04400273412466049, 0.038803163915872574, 0.021683309227228165, 0.02295554429292679, -0.03296747803688049, -0.007049149367958307, -0.012266004458069801, -0.009521018713712692, -0.013745669275522232, -0.004663709085434675, -0.01606888137757778, -0.0023162972647696733, -0.015944423153996468, -0.02537555620074272, -0.018945237621665, 0.0030181007459759712, 0.01265320647507906, 0.004712109453976154, 0.02267897129058838, -0.02790619619190693, -0.004788166843354702, 0.006188316736370325, -0.018170833587646484, -0.026302075013518333, -0.02126844972372055, -0.023785261437296867, 0.02508515492081642, 0.01951221190392971, -0.007896154187619686, -0.014098298735916615, 0.03213776275515556, -0.0026499133091419935, 0.01682945527136326, -0.007260036189109087, 0.017977232113480568, 0.00786849670112133, -0.027767909690737724, -0.009023187682032585, 0.010357651859521866, -0.0319441594183445, 0.013033493421971798, 0.01107674092054367, 0.022568341344594955, -0.015017903409898281, -0.027767909690737724, 0.02527875453233719, 0.0034174027387052774, 0.0026758420281112194, -0.033631253987550735, -0.0431177020072937, -0.0027691852301359177, 0.005638628266751766, -0.008345584385097027, 0.030920840799808502, -0.01091771200299263, 0.016774140298366547, 0.003540131961926818, 0.0367288701236248, 0.0016827727667987347, -0.002292097080498934, 0.004722480662167072, -0.017050713300704956, 0.008988616056740284, 0.012909036129713058, -0.01383555494248867, 0.0011719772592186928, -0.0008392256568185985, 0.009686962701380253, -0.014851960353553295, -0.018848437815904617, -0.011685200966894627, 0.006018915679305792, 0.002088124630972743, 0.015031732618808746, 0.0019014381105080247, 0.04624297469854355, 0.05520393326878548, 0.0007951468578539789, -0.0036853328347206116, -0.009922049939632416, -0.010571995750069618, 0.023660805076360703, -0.03755858913064003, 0.007979125715792179, 0.004141678102314472, -0.0028884573839604855, 0.0037890474777668715, -0.011975603178143501, -0.03617572411894798, 0.008525356650352478, 0.015916764736175537, -0.006005087401717901, 0.023453375324606895, 0.026882877573370934, 0.015847621485590935, -0.027256250381469727, -0.0020967675372958183, -0.03349296748638153, -0.01149851456284523, 0.005652457010000944, 0.0005341312498785555, 0.005835686344653368, -0.008069011382758617, 0.013607382774353027, -0.6358962059020996, -0.019885584712028503, -0.006758748088032007, -0.02240239828824997, 0.012293661944568157, -0.008684386499226093, 0.00900244526565075, 0.016787970438599586, -0.015501906163990498, 0.015017903409898281, 0.014070642180740833, 0.015322133898735046, -0.02819659747183323, -0.00634043151512742, 0.014727502129971981, -0.026412703096866608, 0.02964860573410988, -0.04248158261179924, -0.005998172797262669, 0.02502983994781971, -0.02302468754351139, 0.004356021992862225, 0.0029697006102651358, 0.006150288041681051, 0.015501906163990498, 0.0174240879714489, -0.0005362919764593244, -0.0032531877513974905, -0.02154502272605896, 0.01926329731941223, -0.015073218382894993, 0.03919036686420441, 0.009742277674376965, 0.02099187672138214, 0.039743512868881226, 0.009652391076087952, -0.011588401161134243, 0.014409443363547325, 0.011097484268248081, 0.042094383388757706, -0.025555327534675598, -0.009057759307324886, 0.027200935408473015, 0.010959197767078876, -0.0038097905926406384, -0.006734548136591911, 0.03490348905324936, 0.002857342828065157, -0.024034177884459496, -0.0017156157409772277, 0.01895906589925289, -0.002432112116366625, -0.023494860157370567, 0.0088572446256876, 0.00544848432764411, -0.015474248677492142, 0.004269592929631472, -0.00726695079356432, -0.0017890804447233677, -0.0006495139678008854, -0.002221225295215845, 0.02125462144613266, -0.022761942818760872, -0.026965849101543427, 0.005891000851988792, 0.007578094955533743, -0.030644267797470093, 0.013386123813688755, 0.016442254185676575, -0.01716134324669838, 0.015156189911067486, 0.020466387271881104, -0.007474380079656839, 0.004528879653662443, -0.00561097078025341, 0.017880432307720184, 0.028708258643746376, -0.00858067162334919, -0.003719904227182269, 0.020867418497800827, -0.02265131287276745, -0.012922864407300949, -0.0174932312220335, -0.01626248098909855, 0.00826952699571848, -0.0066100903786718845, -0.008345584385097027, 0.0024960695300251245, 0.003851276356726885, -0.02415863610804081, 0.010883140377700329, 0.004390593618154526, 0.007854667492210865, -0.013648868538439274, 0.01047519501298666, 0.02942734770476818, 0.02211199700832367, 0.009624733589589596, 0.014603044837713242, -0.021406736224889755, -0.0186548363417387, 0.010129479691386223, 0.014699844643473625, 0.0016542511293664575, -0.01048211008310318, -0.006101887673139572, 0.008850330486893654, 0.02150353603065014, -0.001007762155495584, -0.018945237621665, -0.009140731766819954, -0.005057825241237879, -0.011885716579854488, -0.004037963226437569, -0.013731840066611767, -0.036562927067279816, 0.033271707594394684, 0.0066930619068443775, 0.009776849299669266, -0.016456082463264465, 0.012604805640876293, -0.027823224663734436, 0.02679990604519844, -0.00961781945079565, -0.006184859666973352, 0.013565896078944206, 0.025403212755918503, -0.016483739018440247, -0.020784446969628334, 0.013054236769676208, 0.0036887899041175842, -0.022222625091671944, 0.017050713300704956, -0.015363619662821293, -0.008843415416777134, -0.006592804566025734, 0.002454583765938878, -0.020314272493124008, -0.012750006280839443, -0.020549360662698746, -0.030671924352645874, -0.0054865130223333836, -0.007107921410351992, 0.02415863610804081, -0.03396314010024071, -0.0022557969205081463, 0.026149960234761238, 0.012750006280839443, -0.017341114580631256, 0.016691168770194054, 0.02792002633213997, 0.009541762061417103, -0.019705813378095627, 0.019733469933271408, 0.020314272493124008, -0.008553014136850834, -0.01164371520280838, -0.034986462444067, -0.0191664956510067, -0.021738622337579727, 0.011609143577516079, 0.011844230815768242, -0.016677340492606163, -0.0006335246143862605, 0.0014347215183079243, -0.025181954726576805, 0.012597891502082348, 0.011415543034672737, -0.004805452656000853, -0.00611571641638875, 0.0014848503051325679, -0.019138839095830917, -0.004466651007533073, 0.006122630555182695, -0.013351552188396454, 0.03634166717529297, 0.009375818073749542, 0.00632660323753953, -0.014139785431325436, 0.014755159616470337, -0.003972277045249939, 0.003619646653532982, -0.0045911087654531, 0.01048211008310318, 0.029316717758774757, -0.013558981940150261, 0.002712142188102007, 0.023052344098687172, -0.004784709773957729, -0.0026343560311943293, -0.019014380872249603, 0.004172792192548513, -0.005116596817970276, 0.01382172666490078, 0.001671536942012608, -0.006133002229034901, 0.026357389986515045, 0.021088676527142525, 0.01253566239029169, 0.0016101723304018378, 0.011989431455731392, 0.032469648867845535, 0.01689859852194786, -0.008670557290315628, -0.015197675675153732, -0.03282919153571129, -0.015944423153996468, -0.008649814873933792, 0.008732786402106285, 0.008255698718130589, 0.005690485704690218, 0.00181673769839108, -0.00929284654557705, -0.005178825929760933, 0.01688477024435997, -0.0015816508093848825, -0.004615308716893196, 0.02909545972943306, -0.012127717956900597, 0.016110366210341454, -0.00024308158026542515, -0.012431947514414787, 0.013427610509097576, -0.03457160294055939, 0.01122885663062334, 0.004238478373736143, -0.0017873517936095595, 0.0073775798082351685, 0.003016372211277485, -0.0028400570154190063, -0.0039307912811636925, 0.020618503913283348, 0.009050845168530941, -0.004044877365231514, 0.02266514115035534, 0.003249730449169874, 0.02761579491198063, -0.02507132478058338, 0.038830824196338654, -0.0031477443408221006, 0.004145135171711445, 0.018945237621665, 0.019069695845246315, 0.007425980176776648, 0.02207051031291485, -0.0006750104948878288, 0.04109872132539749, 0.002193568041548133, -0.0014044713461771607, 0.01555722113698721, -3.451758311712183e-05, 0.0013379210140556097, 0.012307490222156048, -0.025693614035844803, -0.0021123248152434826, -0.024836238473653793, 0.016718827188014984, 0.010406051762402058, 0.018184661865234375, -0.0005583313759416342, 0.013469096273183823, -0.012694692239165306, 0.008974787779152393, 0.0032065161503851414, 0.013240923173725605, -0.006661947816610336, 0.0028590713627636433, -0.007896154187619686, 0.016732655465602875, -0.022222625091671944, 0.03399080038070679, -0.01803254708647728, 0.021600335836410522, 0.011470857076346874, -0.0016663512215018272, 0.005918658338487148, 0.0028936429880559444, 0.004642966203391552, -0.01808786205947399, 0.002352597424760461, -0.008020611479878426, -0.047902412712574005, 0.014672188088297844, 0.010973026044666767, 0.005628256592899561, 0.008096668869256973, 0.02266514115035534, 0.016663512215018272, -0.0029022858943790197, 0.01629013940691948, -0.008511528372764587, -0.0241724643856287, -0.0131026366725564, 0.011947945691645145, 0.015654021874070168, -0.02215348184108734, 0.03371422737836838, -0.03379719704389572, -0.017064543440937996, -0.017659174278378487, -9.939335723174736e-05, 0.008075926452875137, -0.0013638497330248356, 0.009299760684370995, 0.04331130161881447, 0.009043931029736996, -0.007446723058819771, -0.0026810276322066784, -0.016691168770194054, -0.02851465716958046, 0.019138839095830917, -0.010392223484814167, -0.031833529472351074, 0.014589215628802776, 0.02065998874604702, 0.009265189059078693, -0.009852906689047813, -0.012238346971571445, 0.011346399784088135, 0.012307490222156048, -0.020604673773050308, -0.007405237294733524, -0.036203380674123764, 0.0128122353926301, 0.10797403007745743, 0.02995283529162407, -0.025195783004164696, 0.005406998563557863, 0.001823651953600347, -0.0010501124197617173, -0.02154502272605896, -0.03689481317996979, 0.020604673773050308, -0.000838793464936316, 0.004231564234942198, 0.0009705977281555533, 0.013724925927817822, 0.010226279497146606, 0.01075176801532507, -0.024822410196065903, -0.0029420433565974236, -0.01859952136874199, -0.0029092002660036087, -0.03836064785718918, -0.014215842820703983, -0.004878052975982428, 0.016704997047781944, 0.0315016433596611, 0.02299702912569046, 0.018461234867572784, 0.04939590394496918, 0.014907274395227432, 0.034765202552080154, -0.019719641655683517, 0.005832229275256395, 0.008262612856924534, 0.007260036189109087, 0.014174357056617737, -0.014630701392889023, -0.0006732819601893425, -0.022609828040003777, 0.0320824459195137, 0.004480479750782251, 0.003975734114646912, 0.0253340695053339, 0.013745669275522232, 0.013386123813688755, -0.01806020550429821, -0.00040254308260045946, -0.0026222560554742813, 0.0035038318019360304, 0.011761259287595749, 0.007114835549145937, -0.012715434655547142, 0.013648868538439274, -0.007246207911521196, -0.03318873792886734, -0.014036070555448532, 0.001718208659440279, 0.012646292336285114, -0.004483936820179224, -0.01597207970917225, -0.0131026366725564, -0.015861451625823975, -0.010654967278242111, -0.0344056561589241, 0.023688461631536484, -0.009009359404444695, 0.0198164414614439, -0.01891758106648922, -0.02236091159284115, -0.030948497354984283, -0.027574310079216957, -0.016511397436261177, 0.0044286223128438, 0.0055867708288133144, -0.043504904955625534, -0.0061710309237241745, 0.024518180638551712, 0.030754897743463516, 0.014879616908729076, 0.011007597669959068, -0.020881246775388718, -0.0023733405396342278, 0.011055998504161835, -0.017562374472618103, -0.007329179439693689, -0.011457028798758984, -0.0035124747082591057, -0.005310197826474905, -0.0008336077444255352, -0.006952349096536636, 0.004777795169502497, 0.004463193938136101, -0.005510713439434767, 0.004155506379902363, -0.008546099998056889, -0.037088412791490555, 0.0027933854144066572, -0.013614296913146973, -0.005462313070893288, 0.0018979809246957302, 0.011180455796420574, -0.01866866461932659, 0.001273099216632545, 0.003534946357831359, -0.0033586311619728804, 0.006578975822776556, -0.021061019971966743, 0.0152806481346488, 0.004788166843354702, 0.023135315626859665, -0.03988179937005043, 0.009507190436124802, 0.023066172376275063, -0.016469910740852356, -0.0007406965596601367, 0.03058895282447338, -0.007654152810573578, 0.018945237621665, -0.004501222632825375, -0.0006348210154101253, -0.018488893285393715, -0.0075227804481983185, 0.01454772986471653, -0.015916764736175537, 0.03255261853337288, 0.009389647282660007, -0.02823808416724205, -0.003965362906455994, -0.0012324776034802198, -0.03490348905324936, -0.014174357056617737, 0.028072141110897064, -0.03719904273748398, 0.02592870034277439, -0.027850883081555367, -0.02186308056116104, -0.02617761678993702, -0.03202713280916214, -0.03960522636771202, -0.005472684744745493, -0.0008928116294555366, -0.0046706232242286205, 0.0012990279356017709, -0.029925178736448288, 0.01020553708076477, -0.03376954048871994, -0.017852775752544403, -0.03089318238198757, -0.01604122295975685, 0.0009662762749940157, 0.004836567211896181, 0.033603597432374954, -0.003948077093809843, 0.013372295536100864, -0.026398874819278717, -0.023370401933789253, -0.02241622656583786, -0.022056682035326958, 0.01949838362634182, -0.02035575918853283, 0.038305334746837616, 0.01555722113698721, 0.032690905034542084, -0.0008444113773293793, 0.0348481759428978, 0.020590845495462418, 0.01382172666490078, -0.006070773117244244, -0.006157202180474997, 0.0001258622360182926, -0.00039973415550775826, 0.027270078659057617, -0.010668796487152576, 0.00317194452509284, 0.014284986071288586, 0.014561559073626995, -0.006368089001625776, 0.018267635256052017, -0.006419946439564228, 0.007896154187619686, -0.014810474589467049, -0.025984015315771103, -0.023425716906785965, 0.005929029546678066, -0.011083655059337616, -0.018267635256052017, -0.01947072520852089, 0.01107674092054367, 0.003019829513505101, 0.02502983994781971, 0.024269264191389084, -0.009348161518573761, -0.0013007564703002572, 0.00024372979532927275, 0.019097352400422096, 0.002784742508083582, 0.021918395534157753, -0.012756921350955963, -0.002990443492308259, -0.02180776558816433, -0.02937203273177147, 0.015156189911067486, -0.00342258857563138, 0.011111312545835972, 0.012445776723325253, -0.012286746874451637, 0.00407253485172987, 0.0022333255037665367, -0.024366063997149467, -0.008954044431447983, 0.0192356389015913, -0.025264926254749298, -0.016138022765517235, -0.02739453688263893, -0.01659436896443367, -0.010903882794082165, -0.0003550071269273758, -0.014755159616470337, 0.0004489986749831587, -0.00309070129878819, -0.011609143577516079, -0.013531324453651905, -0.026606304571032524, 0.0023387689143419266, 0.036258697509765625, -0.017921919003129005, 0.0064752609468996525, 0.00010879251203732565, 0.008103583008050919, -0.016124194487929344, -0.0038097905926406384, 0.0069246916100382805, 0.011443200521171093, 0.010502852499485016, 0.033271707594394684, -0.02157267928123474, -0.019885584712028503, 0.008587585762143135, 0.006060401909053326, -0.016635853797197342, -0.0037648475263267756, -0.012093146331608295, -0.019567526876926422, -0.0026343560311943293, 0.0003040140145458281, -0.02942734770476818, -0.020784446969628334, -0.0054899705573916435, 0.002898828824982047, 0.005984344054013491, -6.028423013049178e-05, -0.014464758336544037, -0.011408628895878792, 3.5057764762314036e-05, 0.012321318499743938, -0.00407253485172987, 0.012300576083362103, -0.005693942774087191, 0.004138220567256212, -0.03664589673280716, 0.005351684056222439, 0.03354828059673309, -0.0048296526074409485, 0.007716381456702948, -0.014810474589467049, 0.028002997860312462, -0.009279018267989159, 0.004477022215723991, -0.029510319232940674, -0.014326471835374832, -0.008815758861601353, 0.024545837193727493, 0.013240923173725605, 0.002864257199689746, -0.006782948039472103, -0.021130163222551346, 0.007004206534475088, -0.013918526470661163, -0.004501222632825375, -0.02241622656583786, -0.0198164414614439, 0.0062574599869549274, 0.02036958746612072, 0.015958251431584358, -0.009852906689047813, 0.02731156535446644, -0.004203906748443842, 0.0013560710940510035, 0.014520072378218174, -0.015363619662821293, 0.003858190728351474, -0.02856997214257717, -0.014907274395227432, -0.03205478936433792, -0.0006806284072808921, -0.000587285088840872, -0.013268580660223961, -0.0033448024187237024, 0.00473630940541625, 0.004497765563428402, 0.0029679720755666494, 0.0097630200907588, -0.004629137460142374, 0.0021330679301172495, -0.029786892235279083, 0.02012067288160324, -0.011470857076346874, 2.7022568247048184e-05, 0.023204458877444267, 0.0015479434514418244, -0.015598706901073456, 0.00421773549169302, 0.005852972157299519, -0.002850428456440568, 0.01120811328291893, 0.0013742211740463972, 0.0007925539393909276, 0.021061019971966743, 0.014741331338882446, -0.02939968928694725, -0.008947130292654037, 0.0119410315528512, -0.023176802322268486, -0.0033793740440160036, 0.02121313475072384, -0.021738622337579727, 0.012618634849786758, 0.00741215143352747, 0.014354129321873188, 0.010737939737737179, -0.02851465716958046, -0.014354129321873188, -0.0012281561503186822, -0.014409443363547325, 0.030063465237617493, 0.005987801589071751, -0.022181140258908272, -0.015501906163990498, -0.016469910740852356, -0.0021382535342127085, 0.008172726258635521, 0.0016559796640649438, 0.019125010818243027, 0.013558981940150261, 0.012404290959239006, 0.02390971966087818, -0.016801798716187477, -0.008511528372764587, -0.026371218264102936, -0.025472356006503105, -0.0313633568584919, -0.007930725812911987, -0.014450929127633572, 0.02733922190964222, 0.0023370403796434402, -0.023066172376275063, -0.043173015117645264, -0.001783894607797265, -0.02738070860505104, -0.02266514115035534, 0.005292912013828754, 0.0023698832374066114, 0.030782554298639297, -0.019982386380434036, -0.02854231372475624, 0.027463680133223534, 0.0004252307116985321, 0.03423971310257912, 0.001823651953600347, -0.011802745051681995, 0.026730762794613838, -0.007232379168272018, 0.010094908066093922, -0.02180776558816433, -0.017866604030132294, -0.007688724435865879, 0.007308436557650566, 0.006264374125748873, 0.008926387876272202, 0.005244512110948563, 0.005655914079397917, 0.007439808454364538, -0.0025634842459112406, 0.01862717978656292, -0.013323895633220673, 0.038858480751514435, 0.005161540117114782, -0.032441992312669754, -0.01984409987926483, 0.0027000419795513153, -0.008421641774475574, -0.003016372211277485, 0.012874464504420757, -0.020604673773050308, -0.0035954464692622423, -0.023481031879782677, -0.0020535532385110855, -0.005054368171840906, -0.010592739097774029, 0.03321639448404312, 0.005566027946770191, -0.02413097769021988, 0.0155710494145751, 0.0201068427413702, 0.009085416793823242, -0.017313458025455475, -0.0009247903362847865, 0.021088676527142525, -0.005403541494160891, 0.002805485390126705, 0.014160527847707272, -0.015501906163990498, 0.006655033212155104, 0.0017138872062787414, 0.0036749611608684063, -0.013572811149060726, -0.003747561713680625, -0.0052099404856562614, -0.0022713541984558105, 0.02565212920308113, 0.015916764736175537, 0.004110563546419144, -0.0031788586638867855, 0.015833793208003044, -0.005922115407884121, 0.01047519501298666, -0.02155885100364685, -0.009645476937294006, -0.005856429226696491, -0.019954727962613106, -0.010731025598943233, 0.018820779398083687, -0.017866604030132294, -0.033631253987550735, -0.007619581185281277, 0.026882877573370934, -0.009790677577257156, -0.009071588516235352, 0.22159013152122498, 0.0029143861029297113, 0.007543523330241442, 0.020148329436779022, 0.0001135461061494425, 0.014976417645812035, 0.027021164074540138, 0.02532024122774601, -0.007833925075829029, 0.02912311814725399, -0.007069892715662718, 0.015667850151658058, 0.001214327523484826, -0.008670557290315628, -0.00726695079356432, -0.00356778921559453, -0.0344056561589241, 0.006793319713324308, -0.035069432109594345, 0.011256513185799122, 0.017894260585308075, -0.008622157387435436, 0.004169335123151541, -0.02013450115919113, -0.004708651918917894, 0.013842469081282616, -0.003910047933459282, 0.00323590193875134, 0.015958251431584358, 0.030035806819796562, -0.009666220284998417, 0.00011160145368194208, -0.0033465309534221888, -0.02942734770476818, 0.01599973812699318, -0.035069432109594345, 0.010005021467804909, -0.0012160560581833124, 0.0191664956510067, -0.00317021575756371, 0.00017361425852868706, 0.008255698718130589, -0.028058312833309174, -0.0032981308177113533, 0.00016421510372310877, 0.004815824329853058, -0.021088676527142525, -0.006834805477410555, 0.013496753759682178, 0.004532337188720703, -0.0050612823106348515, 0.013323895633220673, 0.04284112900495529, 0.016649683937430382, -0.01806020550429821, 0.01369035430252552, 0.03733732923865318, 0.007301522418856621, -0.014755159616470337, 0.020438730716705322, -0.008546099998056889, 0.018737807869911194, 0.005458856001496315, 0.0014554644003510475, 0.010336908511817455, -0.019622841849923134, -0.0048192813992500305, 0.01629013940691948, 0.026149960234761238, 0.0011028341250494123, 0.0043076216243207455, -0.002241968410089612, -0.013648868538439274, 0.010005021467804909, -0.04491542652249336, -0.027270078659057617, 0.04242626950144768, 0.03758624568581581, 0.021102504804730415, 0.016483739018440247, 0.02534789778292179, 0.014782817102968693, 0.010191707871854305, 0.016787970438599586, -0.014810474589467049, -0.035982124507427216, 0.021586507558822632, -0.01659436896443367, -0.009666220284998417, -0.026039330288767815, 0.0056455424055457115, 0.0009342975099571049, -0.00873970054090023, -0.028984831646084785, 0.007370665669441223, -0.014699844643473625, -0.02906780317425728, 0.026564817875623703, 0.0042937928810715675, 0.01711985655128956, -0.02619144506752491, 0.017548544332385063, 0.019636670127511024, 0.013662696816027164, -0.01691242679953575, 0.0004965346306562424, -0.009707706049084663, 0.009652391076087952, 0.00813815463334322, -0.009804505854845047, -0.005607513710856438, -0.005348226986825466, 0.024034177884459496, 0.01239737682044506, 0.012183031998574734, 0.016981570050120354, -0.004898795858025551, -0.025126639753580093, 0.035650234669446945, -0.0025634842459112406, -0.014672188088297844, -0.04071151837706566, -0.018253805115818977, 0.009092330932617188, -0.006568604148924351, -0.0021261535584926605, -0.012010174803435802, -0.023660805076360703, -0.012480348348617554, -0.025984015315771103, 0.03863722085952759, 0.015778478235006332, 0.004850395489484072, -0.019373925402760506, 0.004349107388406992, -0.03465457260608673, 0.009486447088420391, -0.009922049939632416, 0.00843547098338604, -0.009285932406783104, -0.02303851582109928, 0.007778610568493605, -0.001578193623572588, -0.010945369489490986, 0.005607513710856438, -0.03938397020101547, 0.017963403835892677, 0.014492415823042393, 0.0188760943710804, -0.021309934556484222, -0.009417303837835789, 0.00778552470728755, -0.01633162423968315, -0.018558036535978317, -0.01268777810037136, -0.014354129321873188, -0.024352235719561577, -0.05014264956116676, 0.006150288041681051, 0.002070839051157236, -0.03111444227397442, 0.015640191733837128, 0.022872570902109146, -0.02469795197248459, -0.024628808721899986, -0.004725937731564045, -0.17767037451267242, 0.01716134324669838, 0.013538239523768425, 0.00042501461575739086, 0.040047742426395416, 0.004394050687551498, 0.021116334944963455, -0.011083655059337616, -0.01801871880888939, 0.01656671240925789, 0.01630396768450737, 0.0027155992574989796, -0.0182952918112278, -0.03280153498053551, -0.0027294280007481575, 0.020494045689702034, 0.00028716036467812955, 0.009721534326672554, 0.031280383467674255, 0.007190892938524485, 0.0174932312220335, -0.027698766440153122, -0.008110498078167439, 0.016442254185676575, 0.005714685656130314, -0.0023232116363942623, 0.0034969174303114414, 0.01049593836069107, -0.008262612856924534, -0.030644267797470093, -0.0005730242701247334, 0.0018755093915387988, 0.03753093257546425, -0.009700790978968143, 0.02184925228357315, -0.0003176266036462039, -0.009189131669700146, -0.0238820631057024, 0.0019221811089664698, 0.001809823326766491, 0.012487262487411499, 0.035677891224622726, 0.0020984963048249483, 0.013303152285516262, -0.023121487349271774, 0.0034986461978405714, 0.024656467139720917, -0.01891758106648922, 0.004027591552585363, 0.010827825404703617, 0.025818072259426117, -0.052216947078704834, 0.016373110935091972, -0.004760509356856346, 0.013130294159054756, -0.009507190436124802, 0.017866604030132294, 0.002286911476403475, -0.008311012759804726, -0.0044286223128438, 0.0015807865420356393, -0.01235589012503624, 0.011740515939891338, -0.03462691605091095, -0.010855482891201973, -0.02537555620074272, -0.007405237294733524, 0.001956752734258771, -0.0371713861823082, 0.02323211543262005, -0.0018685950199142098, -0.0039169625379145145, 0.020272787660360336, 0.008248784579336643, 0.00313045852817595, 0.006509832572191954, -0.003733732970431447, 0.049921393394470215, 0.005299826618283987, -0.013579725287854671, -0.012079318054020405, 0.043228331953287125, 0.0026153416838496923, 0.0053413123823702335, -0.004432079382240772, 0.024532008916139603, 0.0182952918112278, 0.0003212998271919787, -0.0097284484654665, -0.02244388312101364, 0.009265189059078693, 0.0009835620876401663, -0.0013958284398540854, -0.005223769228905439, 0.006416489370167255, 0.017949575558304787, -0.002738070907071233, 0.0008642900502309203, 0.0030941583681851625, -0.014630701392889023, -0.011657544411718845, -0.013489838689565659, -0.006485632620751858, -0.013061150908470154, 0.035097088664770126, 0.003560875076800585, -0.015363619662821293, 0.031888846307992935, 0.02095039002597332, -0.002646456006914377, -0.027449851855635643, 0.016428425908088684, 0.020189816132187843, 0.026924364268779755, 0.0006356853409670293, 0.02243005484342575, -0.006613547448068857, -0.02353634685277939, 0.009548676200211048, -0.030063465237617493, 0.049064017832279205, 0.008020611479878426, -0.01743791624903679, -0.013330809772014618, 0.005306740757077932, -0.005406998563557863, -0.10105970501899719, 1.5543715562671423e-05, 0.019595183432102203, 0.0015816508093848825, 0.00069964281283319, 0.033271707594394684, 0.01626248098909855, 0.021392907947301865, -0.037116073071956635, 0.04806835576891899, -0.0018876094836741686, -0.03559492155909538, -0.013455267064273357, 0.02007918618619442, -0.012639377266168594, 0.016704997047781944, 0.004397507756948471, -0.006789862643927336, -0.02594253048300743, 0.021033361554145813, -0.009057759307324886, -0.025707442313432693, -2.683350430743303e-05, -0.009970449842512608, 0.004165878053754568, 0.002765728160738945, -0.029510319232940674, 0.011097484268248081, 0.00515808304771781, 0.006744919344782829, 0.002274811500683427, -0.021047191694378853, 0.017023056745529175, -0.02128227800130844, 0.003899676725268364, 0.009735362604260445, -0.02679990604519844, -0.024366063997149467, 0.028307227417826653, -0.006613547448068857, 0.007080263923853636, 0.020189816132187843, 0.020590845495462418, -0.03700544312596321, -0.023052344098687172, 0.008553014136850834, -0.003878933610394597, 0.0032998593524098396, 0.014561559073626995, -0.0038720194716006517, -0.013842469081282616, 0.010087992995977402, -0.010129479691386223, -0.014215842820703983, 0.01888992264866829, -0.015930594876408577, 0.012514919973909855, 0.023799089714884758, -0.020162157714366913, -0.005192654673010111, 0.0003241087542846799, -0.014907274395227432, -0.016428425908088684, -0.0056489999406039715, 0.014865788631141186, -0.02848700061440468, -0.024836238473653793, -0.01864100806415081, -0.003937705419957638, -0.03584383800625801, -0.0028556142933666706, 0.04342193156480789, -0.022222625091671944, 0.016345452517271042, -0.019705813378095627, -0.02237473987042904, -0.0038616477977484465, -0.017064543440937996, 0.01775597408413887, -0.010502852499485016, -0.0030077293049544096, -0.024656467139720917, 0.00021445196762215346, -0.015391277149319649, 0.03111444227397442, 0.006859005894511938, 0.0029385860543698072, -0.00634388905018568, -0.0046740807592868805, -0.004999053664505482, -0.023176802322268486, -0.0031996017787605524, 0.012148460373282433, -0.020494045689702034, -0.012590977363288403, 0.013220180757343769, 0.00428342167288065, -0.02361931838095188, -0.005317112430930138, 0.02563829906284809, -0.014768987894058228, 0.029869863763451576, -0.05207866057753563, 0.03755858913064003, -0.01922181062400341, -0.00990822073072195, -0.004107106477022171, -0.011858059093356133, 0.01325475238263607, -0.009500276297330856, -0.017023056745529175, 0.0097284484654665, -0.03412908688187599, 0.012902121990919113, -0.0044286223128438, -0.00713557843118906, -0.0029420433565974236, -0.01833677664399147, 0.025458527728915215, -0.04419633373618126, 0.004214278422296047, 0.02970392070710659, 0.01949838362634182, -0.0038374478463083506, 0.02738070860505104, -0.0017545088194310665, 0.0021503535099327564, 0.000630067428573966, -0.03291216492652893, 0.012134632095694542, -0.011864973232150078, -0.013600467704236507, 0.009078502655029297, -0.007011120673269033, -0.009742277674376965, -0.005680114030838013, 0.0040033916011452675, -0.008297184482216835, -0.004065620247274637, 0.017396429553627968, 0.009631648659706116, 0.010101822204887867, -0.019609011709690094, -0.012487262487411499, 0.002508169738575816, -0.010371480137109756, -0.016746483743190765, 0.0026775705628097057, -0.0005263526109047234, 0.004044877365231514, 0.02244388312101364, 0.013171779923141003, -0.008124326355755329, 0.0008664507768116891, -0.013572811149060726, -0.021586507558822632, 0.0027501708827912807, -0.004387136083096266, 0.01017096545547247, -0.015087046660482883, -0.0027639996260404587, -0.010247022844851017, 0.02065998874604702, -0.00661700451746583, -0.0025219982489943504, -0.02826574072241783, 0.02536172606050968, -0.008055183105170727, 0.0005570349167101085, -0.005458856001496315, 0.035041775554418564, -0.026108473539352417, -0.02296937257051468, -0.015211504884064198, 0.0020172528456896544, 0.026440361514687538, -0.013994584791362286, -0.018184661865234375, 0.025486184284090996, -0.02473943866789341, -0.013462182134389877, 0.01888992264866829, -0.005285997875034809, -0.023812919855117798, 0.010737939737737179, -0.010191707871854305, 0.028652943670749664, -0.004922996275126934, -0.0019377382704988122, -0.0036092752125114202, 0.014478586614131927, 0.023204458877444267, 0.013282408937811852, 0.009244446642696857, -0.012964350171387196, -0.04256455600261688, 0.0020812104921787977, 0.009991193190217018, 0.005064739845693111, -0.0010302336886525154, -0.016953913494944572, 0.015902936458587646, 0.007322265300899744, 0.00749512342736125, 0.0050509111024439335, -0.021392907947301865, -0.025970187038183212, 0.012915950268507004, 0.003695704275742173, -0.019069695845246315, -0.015045560896396637, 0.029455004259943962, 0.03119741380214691, 0.011837316676974297, -0.016787970438599586, 0.008573757484555244, -0.005683571100234985, 0.0038823909126222134, 0.01297817938029766, -0.032165419310331345, -0.0002281725755892694, 0.037060756236314774, 0.032690905034542084, 0.01250109076499939, 0.025541499257087708, -0.01720282807946205, 0.03365891054272652, 0.0021780109964311123, -0.0052687120623886585, -0.01162988692522049, 0.014644530601799488, -0.007232379168272018, -0.016400767490267754, -0.0024632266722619534, 0.011595315299928188, -0.010288508608937263, -0.013482924550771713, -0.032773878425359726, 0.008718958124518394, 0.011491600424051285, 0.006167573854327202, 0.06975166499614716, -0.0057319714687764645, -0.018820779398083687, 0.009064674377441406, 0.007149407174438238, 0.010212451219558716, -0.008760443888604641, 0.0029852578882128, -0.028597628697752953, -0.01922181062400341, 0.020798275247216225, -0.008573757484555244, 0.01572316512465477, -0.013054236769676208, -0.011546915397047997, 0.00799295399338007, 0.021738622337579727, 0.04071151837706566, -0.038554251194000244, 0.006890119984745979, 0.01398075558245182, 0.02973157726228237, -0.0007121749804355204, -0.0015030003851279616, -0.003910047933459282, -0.006776033900678158, 0.020908905193209648, -0.0019066238310188055, -0.02092273347079754, -0.041181690990924835, 0.0031805874314159155, -0.005956687033176422, -0.042094383388757706, -0.013289324007928371, 0.00023789583065081388, -0.015335962176322937, 0.005144254304468632, -0.013953098095953465, 0.04342193156480789, 0.0038685621693730354, -0.02126844972372055, 0.007087178528308868, -0.009126902557909489, -0.013538239523768425, 0.03966054320335388, 0.014879616908729076, -0.013994584791362286, -0.0021468964405357838, -0.009652391076087952], 'k': 2, 'num_candidates': 20}}\n",
      "INFO:elastic_transport.transport:POST http://localhost:9200/paul_graham/_search [status:200 duration:0.034s]\n",
      "POST http://localhost:9200/paul_graham/_search [status:200 duration:0.034s]\n",
      "He invested $6k per founder, which in the typical two-founder case was $12k, in return for 6%.\n"
     ]
    }
   ],
   "source": [
    "def custom_query(query, query_str):\n",
    "    print(\"custom query\", query)\n",
    "    return query\n",
    "\n",
    "\n",
    "query_engine = index.as_query_engine(\n",
    "    vector_store_kwargs={\n",
    "        \"es_filter\": [{\"match\": {\"content\": \"growing up\"}}],\n",
    "        \"custom_query\": custom_query,\n",
    "    }\n",
    ")\n",
    "response = query_engine.query(\"what were his investments in Y Combinator?\")\n",
    "print(response)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
